package com.tool.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.tool.utils.ChineseToEnglish;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@RestController
@Api(tags = "汉字转拼音")
public class HanzhiToPinyinController {

	@GetMapping("to_pinyin/{msg}")
	@ApiOperation("汉字转全拼")
	public String toPinyin(@ApiParam("汉字") @PathVariable String msg) {
		return ChineseToEnglish.getPingYin(msg);
	}
	
	@GetMapping("to_pinyin_handchar/{msg}")
	@ApiOperation("汉字转首字母")
	public String toPinYinHeadChar(@ApiParam("汉字") @PathVariable String msg) {
		return ChineseToEnglish.getPinYinHeadChar(msg);
	}
	
	@GetMapping("to_ASCII/{msg}")
	@ApiOperation("汉字转ASCII码")
	public String toASCII(@ApiParam("汉字") @PathVariable String msg) {
		return ChineseToEnglish.getCnASCII(msg);
	}
	
}
